all stats

Tæmt modʒiɹæ's stats

guessed the most

namecorrect guessesgames togetherratio

were guessed the most by

namecorrect guessesgames togetherratio

entries

round #22

submitted at
1 like

guesses
comments 0

post a comment


e.py ASCII text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
input = {
    "grid": "::|::::)::::\n::|:):::::A:\n::|##:::):::\n::|::##:::::\n:B|::):##:):\n::|::::::##:",
    "p1": [10, 1], # points index top left
    "p2": [1, 4], # points index top left
    "char": "0"
}

# code starts here

tempgrid = [[str(j) for j in i] for i in input["grid"].split("\n")]
wid = len(tempgrid[0])
hei = len(tempgrid)
grid = {}

for x in range(wid):
    for y in range(hei):
        grid.update({f"{x},{y}":tempgrid[y][x]})

p1 = input["p1"]
p2 = input["p2"]
drawChar = input["char"]

itools = __import__("itertools")
e = [
    (x0:=p1[0]),
    (y0:=p1[1]),
    (x1:=p2[0]),
    (y1:=p2[1]),
    (dx:=abs(x1-x0)),
    (sx:=1 if x0 < x1 else -1),
    (dy:=-abs(y1-y0)),
    (sy:=1 if y0 < y1 else -1),
    (error:=dx+dy),
    [
        [
            (grid.update({f"{x0},{y0}":drawChar})),
            (
                (
                    (e2:=2*error),
                    [
                        [
                            (error:=error+dy),
                            (x0:=x0+sx)
                        ] if x0 != x1 and e2 >= dy else None
                    ],
                    [
                        [
                            (error:=error+dx),
                            (y0:=y0+sy)
                        ] if y0 != y1 and e2 <= dx else None
                    ]
                ) if not(x0 == x1 and y0 == y1) else None
            )
        ] for _ in itools.takewhile(lambda x: not(x0 == x1 and y0 == y1), itools.repeat(None))
    ],
    (grid.update({f"{x1},{y1}":drawChar}))
]

for y in range(hei):
    for x in range(wid):
        print(grid[f"{x},{y}"],end="")
    print()
e_oneline.py ASCII text, with very long lines (877)
1
2
3
4
5
6
[(input:={ # see e.py for a slightly more readable version of the code
    "grid": "::|::::)::::\n::|:):::::A:\n::|##:::):::\n::|::##:::::\n:B|::):##:):\n::|::::::##:", # newline separated lines of characters
    "p1": [10, 1], # point 1 coords, points index top left
    "p2": [1, 4],  # point 2 coords, points index top left
    "char": "0"    # character to draw with
}),(tempgrid:=[[str(j)for j in i]for i in input["grid"].split("\n")]),(wid:=len(tempgrid[0])),(hei:=len(tempgrid)),(grid:={}),[[grid.update({f"{x},{y}":tempgrid[y][x]})for x in range(wid)]for y in range(hei)],(p1:=input["p1"]),(p2:=input["p2"]),(drawChar:=input["char"]),(itools:=__import__("itertools")),(x0:=p1[0]),(y0:=p1[1]),(x1:=p2[0]),(y1:=p2[1]),(dx:=abs(x1-x0)),(sx:=1if x0 < x1 else-1),(dy:=-abs(y1-y0)),(sy:=1if y0 < y1 else-1),(error:=dx+dy),[[(grid.update({f"{x0},{y0}":drawChar})),(((e2:=2*error),[[(error:=error+dy),(x0:=x0+sx)]if x0!=x1 and e2>=dy else None],[[(error:=error+dx),(y0:=y0+sy)]if y0!=y1 and e2<=dx else None])if not(x0==x1 and y0==y1)else None)] for _ in itools.takewhile(lambda x:not(x0==x1 and y0==y1),itools.repeat(None))],(grid.update({f"{x1},{y1}":drawChar})),[[[print(grid[f"{x},{y}"],end="")for x in range(wid)],print()]for y in range(hei)]]